<?php

namespace Biz\Transformers\Site;

use Biz\Dictionaries\TitleDict;
use Biz\Dictionaries\CountryDict;
use Lumen\Http\Resources\Json\Resource;

/**
 * PaperAuthorTransformer.
 *
 * @license [http://www.85do.com] [杭州永奥网络科技有限公司]
 * @copyright Copyright (c) 2018-2026 Hangzhou Yongao Technology Co., Ltd. All rights reserved.
 */
class PaperAuthorTransformer extends Resource
{
    /**
     * Transform the resource into an array.
     *
     * @param \Illuminate\Http\Request $request
     *
     * @return array
     */
    public function toArray($request)
    {
        return [
            'email'            => $this->email,
            'title'            => $this->title,
            'title_name'       => $this->title ? TitleDict::get($this->title) : $this->title,
            'first_name'       => $this->first_name,
            'middle_name'      => $this->middle_name,
            'last_name'        => $this->last_name,
            'country'          => $this->country,
            'country_name'     => $this->country ? CountryDict::get($this->country) : $this->country,
        ];
    }
}
